<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<title>广告注册</title>
<link rel="stylesheet" rev="stylesheet" href="css/style1.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/jquery-ui.css" />
<style type="text/css">
<!--
.atten {font-size:12px;font-weight:normal;color:#F00;}
body {
    font-family: "Trebuchet MS","Helvetica","Arial","Verdana","sans-serif";
    font-size: 62.5%;
   
}
-->
</style>
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script language="javascript" src="js/jquery-ui.js"></script>
<script language="javascript" src="jquery.ui.datepicker-zh-CN.js"></script>
<script language="javascript" src="js/common.js"></script>
<script language="JavaScript">
//页面初始化加载的时候调用的方法
$(document).ready(function(){	
	alert("活动注册加载");
	$.datepicker.setDefaults({
		closeText: "关闭", prevText: "&#x3c;上月", nextText: "下月&#x3e;", currentText: "今天",
	 	monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
	  monthNamesShort: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"], 
	  dayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], 
	  dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], 
	  dayNamesMin: ["日", "一", "二", "三", "四", "五", "六"], weekHeader: "周",
	  dateFormat: "yy-mm-dd", firstDay: 1, isRTL: !1, showMonthAfterYear: !0, yearSuffix: "年" 
		});
  $.datepicker.setDefaults($.datepicker.regional["zh-CN"]);   
	$("#startDate").datepicker({
		dateFormat:"yy-mm-dd"	
	});
	$("#endDate").datepicker({dateFormat:"yy-mm-dd"});

	// 格式化处理开始时间和结束时间
  var startDate = '${activeVo.startDate}';
  var endDate = '${activeVo.endDate}';
  $("#startDate").val(startDate.substr(0,10));
  $("#endDate").val(startDate.substr(0,10));
	  
	// 给保存按钮绑定一个单击事件
  $("#addActiveBtn").bind("click",function(){
	  alert(1);
    autoSelect();
    document.editActiveForm.action = "activeAct!addActive.action";
		document.editActiveForm.submit();
  });

	//给修改按钮绑定一个单击事件
  $("#uptActiveBtn").bind("click",function(){
    autoSelect();
    document.editActiveForm.action = "activeAct!uptActive.action";
		document.editActiveForm.submit();
  });
});

function autoSelect(){
	var rightAdvertIdList = document.editActiveForm.rightAdvertIdList;
	for ( var i = 0; i < rightAdvertIdList.length; i++) {
		rightAdvertIdList[i].selected = true;
	}
}
</script>
<s:debug></s:debug>>
</head>
<body class="ContentBody">
  <s:form action="" method="post" name="editActiveForm" id="editActiveForm">
  <s:hidden name="activeVo.id" value="%{activeVo.id}" />
  <s:set name="butFlgVal" value="%{butFlgVal}"/>
	<div class="MainDiv">
	<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
	  <tr>
	  	<s:if test="#butFlgVal!='upt'">
				<th class="tablestyle_title" >活动注册页面</th>
			</s:if>
			<s:else>
		  	<th class="tablestyle_title" >活动修改页面</th>
			</s:else>	
	  </tr>
	  <tr>
	    <td class="CPanel">
			<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
			<tr>
				<td width="100%">
					<fieldset style="height:100%;">
					<legend>
						<s:if test="#butFlgVal!='upt'">
							活动注册
						</s:if>
						<s:else>
						  活动修改
						</s:else>
					</legend>
						<table border="0" cellpadding="2" cellspacing="1" style="width:100%">
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">活动名字:</td>
						    <td width="87%" colspan="3">
						      <s:textfield name="activeVo.activeName" value="%{activeVo.activeName}" theme="simple"></s:textfield>
					        <span class="red"> *</span>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">描述:</td>
						    <td width="87%" colspan="3">
						      <s:textfield name="activeVo.notes" value="%{activeVo.notes}" size="52" theme="simple"></s:textfield>
					      </td>
						  </tr>
						  <tr>						   
						    <td nowrap="nowrap" align="right" width="13%">选择参加活动的广告:</td>
						    <td width="87%" colspan="3">
						    	<s:action name="advertInfoAct!findAdvertInfoList" id="advertInfoAct">
						    		<s:param name="activeId" value="%{activeVo.id}"/>
						    	</s:action>
						      <s:optiontransferselect
										name="left"
										list="#advertInfoAct.advertVoLeftList"
										listKey="id"
										listValue="advertName"
										multiple="true"
								    emptyOption="false"
								    cssStyle="width:140px;height:150px;"
										
										doubleName="rightAdvertIdList"
										doubleList="#advertInfoAct.advertVoRightList"
										doubleListKey="id"
										doubleListValue="advertName"
										doubleOnselect="true"
										selectAllLabel="true"									
										doubleEmptyOption="false"
								    doubleMultiple="true" 
								    doubleCssStyle="width:140px;height:150px;"
								    allowUpDownOnLeft="false"
								    allowUpDownOnRight="false"
								    addToLeftLabel="导入左侧"
										addAllToRightLabel="全部导入右侧"
										addAllToLeftLabel="全部导入左侧"
										addToRightLabel="导入右侧" 
								    theme="simple"
								    allowSelectAll="false">
									</s:optiontransferselect>
					      </td>					   		   
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">开始时间:</td>
						    <td width="37%">
						    	<s:textfield name="activeVo.startDate" id="startDate" theme="simple"/>						      
					        <span class="red"> *</span>
					      </td>
					      <td nowrap="nowrap" align="right" width="13%">结束时间:</td>
						    <td width="37%">
						        <s:textfield name="activeVo.endDate" id="endDate" theme="simple"/>
					        <span class="red"> *</span>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">活动发起人:</td>
						    <td width="37%">
						      <s:textfield name="activeVo.sponsors" value="%{activeVo.sponsors}" theme="simple"></s:textfield>
					      </td>
					      <td nowrap="nowrap" align="right" width="13%">活动状态:</td>
						    <td width="37%">
						      <s:select name="activeVo.state" listKey="key"
										listValue="value" 	list="#{'0':'关闭','1':'正常'}" theme="simple" />
					        <span class="red"> *</span>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="left" colspan="4">活动参与人条件选择</a></td>
						  </tr>
						  <tr>
						  		
						    <td nowrap="nowrap" align="right" width="13%">年龄:</td>
						    <td width="70%" colspan="3">
						      <s:textfield name="activeVo.minAge" value="%{activeVo.minAge}" theme="simple"></s:textfield>
						      到
						      <s:textfield name="activeVo.maxAge" value="%{activeVo.maxAge}" theme="simple"></s:textfield>
						      岁
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">性别:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist name="sexList" list="#{'1':'男','0':'女'}" listKey="key" listValue="value" theme="simple" />
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('sexList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('sexList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">体重:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'40KG以下',2:'40-60KG',3:'60-80KG',4:'80KG以上'}" name="weightList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('weightList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('weightList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">身高:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'160以下',2:'160-170',3:'170-180',4:'180以上'}" name="heightList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('heightList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('heightList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">血型:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'A型',2:'B型',3:'AB型',4:'O型'}" name="bloodList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('bloodList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('bloodList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">信仰:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'佛教',2:'基督教',3:'伊斯兰教'}" name="beliefList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('beliefList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('beliefList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">文化程度:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'小学',2:'初中',3:'高中',4:'大专',5:'本科',6:'硕士',7:'博士'}" name="degreeList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('degreeList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('degreeList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">行业:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'IT',2:'金融',3:'法律',4:'医生',5:'公务员',6:'其他'}" name="industryList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('industryList')" class="coolbg" />（全选 |
					      	<a href="javascript:unSelectAll('industryList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">收入:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'1000以下',2:'1000-4000',3:'4000-10000',4:'10000以上'}" name="incomeList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					       <td width="17%">
					      	<a href="javascript:selAll('incomeList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('incomeList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						  <tr>
						    <td nowrap="nowrap" align="right" width="13%">婚否:</td>
						    <td width="70%" colspan="2">
						      <s:checkboxlist list="#{1:'已婚',2:'未婚'}" name="marriageList" listKey="key" listValue="value" theme="simple"></s:checkboxlist>
					      </td>
					      <td width="17%">
					      	<a href="javascript:selAll('marriageList')" class="coolbg"/>（全选 |
					      	<a href="javascript:unSelectAll('marriageList')" class="coolbg">反选）</a>
					      </td>
						  </tr>
						</table>
				 <br />
					</fieldset>
				</td>
			</tr>
			</table>
		 </td>
	  </tr>
			<tr>
				<td colspan="3" align="center" height="50px">
					<s:if test="#butFlgVal!='upt'">
						<input type="button" name="addActiveBtn" id="addActiveBtn" value="保&nbsp存" ></input>
					</s:if>
					<s:else>
						<input type="button" name="addActiveBtn" id="uptActiveBtn" value="修&nbsp改" ></input>
					</s:else>
				</td>
			</tr>
			</table>	
	</div>
</s:form>
</body>
</html>

